/*
 * Predictor3.h
 *
 *  Created on: Dec 8, 2014
 *      Author: ale
 */

#ifndef PRED_PREDICTOR3_H_
#define PRED_PREDICTOR3_H_

#include "Predictor2.h"
#include "VectorUnigramas.h"
#include "VectorBigramas.h"
#include "VectorTrigramas.h"

class Predictor3 {
public:
	Predictor3();
	virtual ~Predictor3();

	VectorUnigramas *unigramas;
	VectorBigramas *bigramas;
	VectorTrigramas *trigramas;

	string Aanterior;
	string Banterior;
	istream::streampos offsetActual;

	vector<string> bigramasConAigual;
	vector<double> probConAigual;

	vector<string> trigramasConABiguales;
	vector<double> probConABiguales;


	bool agregarUnigrama(string uni, double prob, double boff);
	bool agregarBigrama(string bigrama, double prob, double boff,istream::streampos offsetInicioDeLinea);
	bool agregarTrigrama(string trigrama, double prob, istream::streampos);

	long double obtenerProb(string ABC);

	/*Del primer termino necesito la probabilidad y del segundo el backoff*/
	long double obtenerProbTermUnigrama(string C, string B);
	long double obtenerProbBigrama(string B, string C);
	long double obtenerBoffBigrama(string A, string B);
	long double obtenerProbTermTrigrama(string A, string B, string C);

	int NgramaMasProbable(vector<double> *probas);

};

#endif /* PRED_PREDICTOR3_H_ */
